//
//  HTTPTool.h
//  Chat
//
//  Created by Wangchengshan on 15/10/26.
//  Copyright (c) 2015年 Wangchengshan. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface HTTPTool : NSObject

/**
 *  GET请求
 *
 *  @param url     请求url
 *  @param params  参数
 *  @param success 成功回调
 *  @param failure 失败回调
 */
+ (void)GET:(NSString *)url parameters:(id)params success:(void(^)(id responseObject))success failure:(void(^)(NSError *error))failure;

/**
 *  POST请求
 *
 *  @param url     请求url
 *  @param params  参数
 *  @param success 成功回调
 *  @param failure 失败回调
 */
+ (void)POST:(NSString *)url parameters:(id)params success:(void(^)(id responseObject))success failure:(void(^)(NSError *error))failure;


+ (void)POSTRaw:(NSString *)url parameters:(id)params success:(void (^)(id))success failure:(void (^)(NSError *))failure;

+ (void)GETRaw:(NSString *)url parameters:(id)params success:(void (^)(id))success failure:(void (^)(NSError *))failure;



/**
 *  检测用户网络状态
 *
 *  @param block 用户网络状态改变回调
 */
+ (void)startMonitoringWithChangeBlock:(void (^)(AFNetworkReachabilityStatus))block;

/**
 *  获取当前设备的IP地址
 */
+ (NSString *)getIPAddress:(BOOL)preferIPv4;

/**
 *  根据网络请求显示状态栏的菊花
 */
+ (void)showNetworkActivityIndicator:(BOOL)open;

@end
